﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;


namespace WpfApplication1
{
    public enum GraphModeSettings : int
    {
        Normal = 1,
        Raw = 2
    }

    public static class GraphMode
    {
        static int[] normal = { 0,1,2,3};
        static int[] raw = { 4, 5, 2, 3 };

        public static string[] GetGraphTitlesByMode(string FileName, GraphModeSettings gmSettings, int GraphIndex)
        {
            switch (gmSettings)
            {
                case GraphModeSettings.Normal:
                    return GetGraphTitles(FileName, normal[GraphIndex]);
                    break;
                case GraphModeSettings.Raw:
                    return GetGraphTitles(FileName, raw[GraphIndex]);
                    break;
                default:
                    return new string[4];
            }

        }

        static string[] GetGraphTitles(string FileName, int index)
        {
            string[] read = Read(FileName);
            
            string[] output = read[index].Split(',');
            return output;
        }

        static string[] Read(string FileName)
        {
            string[] temp = null;
            try
            {
                temp = System.IO.File.ReadAllLines(FileName);
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
            }
            return temp;
        }
    }
}
